unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.OleCtrls, SHDocVw, Vcl.StdCtrls,
  Vcl.ExtCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  IdHTTP;

type
  TForm2 = class(TForm)
    WebBrowser3: TWebBrowser;
    Button1: TButton;
    Edit1: TEdit;
    procedure WebBrowser3DocumentComplete(ASender: TObject;
      const pDisp: IDispatch; const URL: OleVariant);
    procedure Button1Click(Sender: TObject);
    procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
webbrowser3.Navigate('https://na.edit.yahoo.com/registration');
end;

procedure TForm2.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if edit1.Text<>'' then
button1.Enabled:=true
else
button1.Enabled:=false;
end;

procedure TForm2.WebBrowser3DocumentComplete(ASender: TObject;
  const pDisp: IDispatch; const URL: OleVariant);
 begin

if webbrowser3.LocationURL  = 'https://na.edit.yahoo.com/registration' then
begin
(ASender as TWebBrowser).OleObject.document.all.item('firstname',0).value:=edit1.Text;
(ASender as TWebBrowser).OleObject.document.all.item('secondname',0).value:=edit1.Text;
(ASender as TWebBrowser).OleObject.document.all.item('gender',0).selectedIndex:=1;
(ASender as TWebBrowser).OleObject.document.all.item('mm',0).selectedIndex:=1;
(ASender as TWebBrowser).OleObject.document.all.item('dd',0).value:='20';
(ASender as TWebBrowser).OleObject.document.all.item('yyyy',0).value:='1980';
(ASender as TWebBrowser).OleObject.document.all.item('postalcode',0).value:='010858';
(ASender as TWebBrowser).OleObject.document.all.item('yahooid',0).value:=edit1.Text;
(ASender as TWebBrowser).OleObject.document.all.item('password',0).value:='1234asdf';
(ASender as TWebBrowser).OleObject.document.all.item('passwordconfirm',0).value:='1234asdf';
(ASender as TWebBrowser).OleObject.document.all.item('secquestion',0).selectedIndex:=1;
(ASender as TWebBrowser).OleObject.document.all.item('secquestionanswer',0).value:='bobilianoi';
(ASender as TWebBrowser).OleObject.document.all.item('secquestion2',0).selectedIndex:=1;
(ASender as TWebBrowser).OleObject.document.all.item('secquestionanswer2',0).value:='hapciubalaba';

webbrowser3.OleObject.Document.ParentWindow.ScrollTo(0, webbrowser3.OleObject.Document.ParentWindow.Screen.Height);
end;
end;

end.
